#include <iostream>
using namespace std;

int main()
{
    int q = 0;
    cin >> q;
    int a = 0, b = 0, c = 0;
    while(q--)
    {
        int score = 0;
        cin >> a >> b >> c;
        int m = min(a, min(b, c));
        b -= m;
        score += 2*m;
        if(b > 0)
            score += b-1;
        cout << score << endl;
    }
}